<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户管理 - 后台</title>
    <style>
        body { font-family: Arial, sans-serif; margin: 20px; background-color: #f4f4f4; }
        .container { max-width: 960px; margin: 20px auto; padding: 30px; border: 1px solid #ddd; border-radius: 8px; background-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
        h1 { color: #333; text-align: center; margin-bottom: 20px; }
        .actions { margin-bottom: 20px; text-align: right; } /* 新增 */
        .actions a { /* 新增 */
            background-color: #28a745;
            color: white;
            padding: 10px 15px;
            text-decoration: none;
            border-radius: 5px;
            transition: background-color 0.3s ease;
            margin-left: 10px; /* 间隔 */
        }
        .actions a:hover { background-color: #218838; } /* 新增 */
        table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
        th, td { border: 1px solid #ddd; padding: 10px; text-align: left; }
        th { background-color: #f2f2f2; }
        .action-links a { margin-right: 10px; color: #007bff; text-decoration: none; }
        .action-links a:hover { text-decoration: underline; }
        .delete-btn { color: red; } /* 删除按钮样式 */
        .back-link { display: block; margin-top: 20px; text-align: center; }
        .back-link a { color: #007bff; text-decoration: none; }
        .back-link a:hover { text-decoration: underline; }
    </style>
</head>
<body>
    <div class="container">
        <h1>用户管理</h1>
        <div class="actions">
            <a href="{:Url('admin/index/addAdmin')}">新增用户</a>
        </div>
        <table>
            <thead>
                <tr>
                    <th>ID</th>
                    <th>用户名</th>
                    <th>角色</th>
                    <th>注册时间</th>
                    <th>操作</th> </tr>
            </thead>
            <tbody>
                {foreach name="users" item="user"}
                <tr>
                    <td>{$user.id}</td>
                    <td>{$user.username}</td>
                    <td>{$user.role}</td>
                    <td>{$user.create_time}</td>
                    <td class="action-links">
                        <a href="{:Url('admin/index/editAdmin', ['id' => $user.id])}">编辑</a>
                        <a href="{:Url('admin/index/deleteUser', ['id' => $user.id])}" class="delete-btn" onclick="return confirm('确定要删除此用户吗？');">删除</a>
                    </td>
                </tr>
                {/foreach}
            </tbody>
        </table>
        <p class="back-link"><a href="{:Url('admin/index/index')}">返回后台首页</a></p>
    </div>
</body>
</html>